// main/java/com/cinema/model/Movie.java
package main.java.com.cinema.model;

import java.io.Serializable;
import java.time.LocalDateTime;

public class Movie implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;
    private String title;
    private String director;
    private String[] actors;
    private String synopsis;
    private int duration;
    private double rating;
    private LocalDateTime releaseDate; // 如果有这个字段的话

    // 构造函数
    public Movie() {
        this.actors = new String[0]; // 确保数组不为null
    }

    public Movie(String id, String title, String director, String[] actors,
                 String synopsis, int duration, double rating) {
        this.id = id;
        this.title = title;
        this.director = director;
        this.actors = actors != null ? actors : new String[0];
        this.synopsis = synopsis;
        this.duration = duration;
        this.rating = rating;
    }

    // Getters and Setters
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }

    public String getDirector() { return director; }
    public void setDirector(String director) { this.director = director; }

    public String[] getActors() { return actors; }
    public void setActors(String[] actors) { this.actors = actors != null ? actors : new String[0]; }

    public String getSynopsis() { return synopsis; }
    public void setSynopsis(String synopsis) { this.synopsis = synopsis; }

    public int getDuration() { return duration; }
    public void setDuration(int duration) { this.duration = duration; }

    public double getRating() { return rating; }
    public void setRating(double rating) { this.rating = rating; }

    // 如果有releaseDate字段，也需要添加getter/setter
    public LocalDateTime getReleaseDate() { return releaseDate; }
    public void setReleaseDate(LocalDateTime releaseDate) { this.releaseDate = releaseDate; }
}
